#paths to all directories containing sources
#MAINDIR=~/svn/DataPath/branches/alin
MAINDIR=../../
INCLUDE=$(MAINDIR)/Headers
SRCDIR=$(MAINDIR)/Code
VPATH=$(SRCDIR):$(INCLUDE)
#:$(SRCDIR)/misc:$(SRCDIR)/storage:$(SRCDIR)/utils:

M4INCLUDE=-I $(SRCDIR)/M4 

CC = g++
#CC = /opt/pgi/linux86-64/9.0/bin/pgCC -tp=barcelona-64 -lpthread

#CFLAGS = -lpthread -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE  -lxml2
CFLAGS = -g -lpthread -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 


CCFLAGS =  $(CFLAGS)-I $(INCLUDE)  -I ./
# for debug uncomment next line
#CCFLAGS += -g -DDEBUG_EVPROC
# for optimization uncomment the next line
#CCFLAGS += -O4

M4=m4 -s

OBJ = MultiMessageQueue.o EventProcessor.o EventProcessorImp.o 

TESTOBJ = Generator.o Adder.o TestEvProc.o 

RM = rm -rf


%.o: %.cc
	$(CC) $(CCFLAGS) -c -o $@ $^

%.cc: %.cc.m4
	$(M4) $(M4INCLUDE) $< > $@

%.h: %.h.m4
	$(M4) $(M4INCLUDE) $< > $@

test: Message.h $(OBJ) $(TESTOBJ)
	$(CC)  $(CFLAGS) -o test.out $(OBJ) $(TESTOBJ)

clean:
	$(RM) *.o *.out Message.h *~
